<?php
	define('CONFIG_FILE',true);
	include '../config.php';
	
	define('DB_FILE',true);
	require_once '../Tool/DB/SqlDBManager.class.php';
	
	if(isset($_GET['q'])){
		$q =$_GET['q'];

		$sqlDBManager = new SqlDBManager();

		$sql="SELECT activityId,activityName FROM activity WHERE CentreName = ?";
		$parameters = array($q);
		$res=$sqlDBManager->queryRows($sql,$parameters);
		
		$activityList = array();

		for($i=0;$i<count($res);$i++)
		{
			$activityList[] = array( 'activityId' => $res[$i]['activityId'], 'activityName' =>  $res[$i]['activityName']);
		}
		
		echo json_encode($activityList);
	}
?> 
